import types from '@/constants/types'

import router from '@/router/index.js'
import socket from '@/tools/socket.js'
import broadcast from '@/tools/broadcast.js'
import states from '@/store/state.js'
// import loginApi from "@/api/login.js";


import {
  Notification
} from 'element-ui'; // 配置请求的默认值 iframe用?

// initial state
const state = states.teachersState;
// getters
const getters = {
  // getAll: state => state.all,
  teacher_courselist(state, getters, rootState) {
    // console.log(state.teacher_courselist);
    return state.teacher_courselist;
  },
}
// mutations
const mutations = {
  [types.TEACHER_COURSELIST](state, value) {
    state.teacher_courselist = value;
  },
}
// action
const actions = {
  // 教师端课程列表 
  [types.TEACHER_COURSELIST](context, args) {
    loginApi
        .GetCourseListByPage(args)
        .then(res => {
            context.commit(types.TEACHER_COURSELIST, res);
        })
        .catch(err => {
            console.log(err);
        });
  },
}
export default {
  namespaced: true,
  state,
  getters,
  actions,
  mutations
}